<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: Dean <zxxjjforever@163.com>
// +----------------------------------------------------------------------
namespace api\home\controller;

use think\Db;
use think\Validate;
use cmf\controller\RestBaseController;
use api\home\model\DomainModel as Domain;


class IndexController extends RestBaseController
{
    // api 首页
    public function index()
    {
        $this->success("恭喜您,API访问成功!", [
            'version' => '1.0.0',
            'doc'     => 'http://www.kancloud.cn/thinkcmf/cmf5api'
        ]);
    }

    //获取版本号
    public function get_version(){
    	$sets = cmf_get_option('site_info');
        $sets['apkUrl']='http://'.$_SERVER['HTTP_HOST'].'/upload/current.wgt';
        $path=dirname(dirname(dirname(dirname(__FILE__))));
        $sets['apksize']=filesize($path."/public/upload/current.wgt");
        
    	$this->success('',$sets);
    }


    //获取领域
    public function get_domain(Domain $Domain){
        $data = $Domain->get_list(['del'=>0]);
        $this->success('成功',$data);
    }
}
